package src.dual_pointers;

/**
 * @author starsea
 * @date 2024-08-22 9:07
 */

public class Test06 {
    public static void main(String[] args) {
        int[] arr = {1, 1, 0,0, 0, 1};
        int c = findMaxConsecutiveOnes(arr);
    }

    public static int findMaxConsecutiveOnes(int[] nums) {
        int n = nums.length;
        int left = 0;
        int right = 0;
        int ans = 0;
        while (right < n && left <= right) {
            while (right < n && nums[right] == 1) {

                right++;
                ans = ans > right - left ? ans : right - left;

            }
            right++;
            left = right;

        }
        return ans;
    }
}
